import React, {Component} from 'react'
import {
  BrowserRouter as Router,
  Switch,
  Route,
  Link,
  Redirect
} from "react-router-dom";
import routes from './routers'
import Error from './views/Error'
import {renderRoutes} from 'react-router-config' 
export default class App extends Component {
    render() {
        return (
            <div>
              <Router>
                    <Link to="/home">home</Link>
                    <Link to='/about'>about</Link>
                    <Link to='/parent'>parent</Link>

                     {/* <Switch>
                      {routes.map(item=>{
                          return (<Route key={item.path} path={item.path} component={item.component}></Route>)
                      })
                      }
                      <Redirect from='/' to='/home'></Redirect>
                      <Route path='*' component={Error}></Route> 
                    </Switch> */}
                    {renderRoutes(routes)}
              </Router>
            </div>
        )
    }
}